//
//  XYDataReqHelper.h
//  PeiJue
//
//  Created by lxy on 2017/12/6.
//  Copyright © 2017年 lixiya. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "XYHttpManager.h"

typedef void (^RequestCompleteBlock)(XYResult *result);
typedef void (^CompleteBlock)(id response, XYResult *result);

@interface XYDataReqHelper :NSObject

- (NSMutableDictionary *)commonArgumentWithUserParameters:(NSDictionary *)parameters;
- (NSMutableDictionary *)commonH5ArgumentWithUserParameters:(NSDictionary *)parameters;

/**
 用以添加请求头信息
 
 @param value 添加的头信息值
 @param key 头信息关键字
 */
- (void)setHeaderFieldValue:(NSString *)value forKey:(NSString *)key;
- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username
                                       password:(NSString *)password;
- (void)clearAuthorizationHeader;

- (void )reponseURI:(NSString *)uri
operationCompleteBlock:(RequestCompleteBlock)requestCompleteBlock
             result:(XYResult *)result;


- (void)postMultipartFormWithURL:(NSString *)url
                      parameters:(NSDictionary *)parameters
             multipartFormModels:(NSArray<NLMultipartFormArgument *> *)formModels
            requestCompleteBlock:(RequestCompleteBlock)requestCompleteBlock;

- (void)postjsonParametersFormWithURL:(NSString *)url
                           parameters:(NSDictionary *)jsonParameters
                 requestCompleteBlock:(RequestCompleteBlock)requestCompleteBlock;


- (void)requestWithUrl:(NSString *)url
                method:(HttpMethod)method
            parameters:(NSDictionary *)parameters
         completeBlock:(CompleteBlock)completeBlock;

- (void)httpRequestMethod:(HttpMethod)method
                      url:(NSString *)url
               parameters:(NSDictionary *)parameters
                 useCache:(BOOL)useCache
              expiredTime:(NSInteger)expiredTime
     requestCompleteBlock:(RequestCompleteBlock)requestCompleteBlock;

- (NSURLSessionDataTask *)httpRequestMethod:(HttpMethod)method
                                        url:(NSString *)url
                                 parameters:(NSDictionary *)parameters
                                   useCache:(BOOL)useCache
                                expiredTime:(NSInteger)expiredTime
                             supportOffLine:(BOOL)supportOffLine
                       requestCompleteBlock:(RequestCompleteBlock)requestCompleteBlock;
@end
